package com.miyake.loveviewweb.client.service;

import java.util.List;
import java.util.Map;

import com.google.appengine.api.datastore.Key;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.miyake.loveviewweb.client.account.LoginInfo;
import com.miyake.loveviewweb.shared.model.ChartModel;
import com.miyake.loveviewweb.shared.model.ChartModel.ChartEngine;
import com.miyake.loveviewweb.shared.model.DataModel;
import com.miyake.loveviewweb.shared.model.FolderModel;
import com.miyake.loveviewweb.shared.model.GroupModel;
import com.miyake.loveviewweb.shared.model.ImageDataBodyModel;
import com.miyake.loveviewweb.shared.model.PluginModel;
import com.miyake.loveviewweb.shared.model.UserModel;
import com.miyake.loveviewweb.shared.model.ValueModel;

public interface DataServiceAsync {

    void createRootFolder(String name, AsyncCallback<FolderModel> callback);

    void getFolder(Key key, AsyncCallback<FolderModel> callback);

    void getRootFolders(AsyncCallback<List<FolderModel>> callback);

    void createFolder(String name, Key parentKey, AsyncCallback<FolderModel> callback);

    void getSubFolders(Key key, AsyncCallback<List<FolderModel>> callback);

    void createData(Key folder, String name, String text,
            AsyncCallback<DataModel> callback);

    void getData(Key key, boolean content, AsyncCallback<DataModel> callback);

    void getDataKeyList(Key folderKey, AsyncCallback<List<Key>> callback);

    void getDataList(Key folderKey, boolean content,
            AsyncCallback<List<DataModel>> callback);

    void updateData(DataModel data, AsyncCallback<Void> callback);

    void setSelectedItem(Key key, AsyncCallback<Void> callback);

    void createChart(String name, Key dataKey, Map<String, String> axisDefine,
            ChartEngine chartEngine, Key pluginKey,
            AsyncCallback<ChartModel> callback);

    void getChart(Key key, boolean content, AsyncCallback<ChartModel> callback);

    void getChartList(Key dataKey, boolean content,
            AsyncCallback<List<ChartModel>> callback);

    void updateChart(ChartModel chartModel, AsyncCallback<Void> callback);

    void updateChartsSize(List<Key> keys, Integer width, Integer height,
            AsyncCallback<Void> callback);

    void updateChartEngine(List<Key> keys, ChartEngine chartEngine,
            Key pluginKey, AsyncCallback<Void> callback);

    void updateChartSize(Key key, Integer width, Integer height,
            AsyncCallback<Void> callback);

    void delete(Key key, AsyncCallback<Void> callback);

    void getSubDataList(Key dataKey, boolean content,
            AsyncCallback<List<DataModel>> callback);

    void getChartList(List<Key> keys, boolean content,
            AsyncCallback<List<ChartModel>> callback);

    void delete(List<Key> keys, AsyncCallback<Void> callback);

    // Plugin
    void removePlugin(Key key, AsyncCallback<Void> callback);

    void getPluginList(String type, String tag,
            AsyncCallback<List<PluginModel>> callback);

    void getPlugin(Key key, AsyncCallback<PluginModel> callback);

    void registerPlugin(String url, AsyncCallback<Key> callback);

    void clearPlugins(AsyncCallback<Void> callback);

    void getMyPluginList(String category, String tag,
            AsyncCallback<List<PluginModel>> callback);

    void removePlugins(List<Key> keys, AsyncCallback<Void> callback);

    void getPluginSetting(Key pluginKey, AsyncCallback<List<ValueModel>> callback);

    void executeDataProcessing(Key pluginKey, List<ValueModel> values,
            Map<String, String> data, Key sourceData,
            AsyncCallback<Key> callback);

    void parseFile(Key dataKey, Key pluginKey, AsyncCallback<Void> callback);

    void setChartListVisible(Key dataKey, boolean visible,
            AsyncCallback<Void> callback);

    void updateFolder(FolderModel folder, AsyncCallback<Void> callback);

    void getDataList(List<Key> dataKeys, boolean content,
            AsyncCallback<List<DataModel>> callback);

    void updateImageDataBodyModel(ImageDataBodyModel imageDataBodyModel,
            AsyncCallback<Void> callback);

    void keyToString(Key key, AsyncCallback<String> callback);

    void stringToKey(String key, AsyncCallback<Key> callback);

    void getChart(Key key, boolean content, ChartEngine engine,
            AsyncCallback<ChartModel> callback);

    void publish(Key contentKey, Key groupKey, AsyncCallback<Void> callback);

    void clearRootFolders(AsyncCallback<Void> callback);
    
    void createUser(UserModel user, AsyncCallback<Key> callback);

    void login(String requestUri, AsyncCallback<LoginInfo> callback);

    void installPlugins(List<Key> keys, AsyncCallback<Void> callback);

    void getInstalledPlugins(String serviceType,
            AsyncCallback<List<PluginModel>> callback);

    void uninstallPlugins(List<Key> keys, AsyncCallback<Void> callback);

    void getAllUsers(AsyncCallback<List<UserModel>> callback);

    void getMyFriends(AsyncCallback<List<UserModel>> callback);

    void createGroup(String name, AsyncCallback<Key> callback);

    void getAllGroups(AsyncCallback<List<GroupModel>> callback);

    void getMyGroups(AsyncCallback<List<GroupModel>> callback);

    void getUsers(List<Key> keys, AsyncCallback<List<UserModel>> callback);

    void getUser(Key key, AsyncCallback<UserModel> callback);

    void joinGroup(Key groupKey, AsyncCallback<Void> callback);

    void getMyProperty(AsyncCallback<UserModel> callback);

    void updateUser(UserModel userModel, AsyncCallback<Void> callback);

    void leaveGroup(Key groupKey, AsyncCallback<Void> callback);

    void deleteUser(Key userKey, AsyncCallback<Void> callback);

    void deleteAllUsers(AsyncCallback<Void> callback);

    void createUser(AsyncCallback<Key> callback);

    void addFriend(Key key, AsyncCallback<Void> callback);

    void byeFriend(Key key, AsyncCallback<Void> callback);

    void deleteGroup(List<Key> keys, AsyncCallback<Void> callback);

    void deleteAllGroups(AsyncCallback<Void> callback);

    void setChartColumns(Key dataKey, int columns, AsyncCallback<Void> callback);
}
